<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<script>
  // 1.参数

  // 1.1.两个参数
  const sum = (num1, num2) => {
    return num1 + num2;
  };
  console.log("sum = " + sum(1, 2));

  // 1.2.一个参数(小括号可以省略)
  const mul = num => {
    return num * num;
  };
  console.log("mul = " + mul(5));

  // 1.3.没有参数(小括号不可以省略)
  const test = () => console.log("Hello Vuejs");

  // 2.返回值

  // 2.1.代码块中有多行代码
  const t1 = num => {
    const result = num * num;
    return result;
  };
  console.log("t1 = " + t1(5));

  // 2.2.代码块中只有一行代码(return和花括号都可以省略)
  const t2 = num => num * num;
  console.log("t2 = " + t2(6));

  // 2.3.没有返回值
  const t3 = () => console.log("Hello World");
  console.log(t3()); // undefined
</script>
</body>
</html>